using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Gko.Utils
{
	[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Utils")]
	public static class DelegateUtils
	{
		public static Delegate Convert(Type destinationType, Delegate source)
		{
			return Delegate.CreateDelegate(destinationType, source.Target, source.Method);
		}

		public static Delegate Convert(Type destinationType, Action source)
		{
			return Delegate.CreateDelegate(destinationType, source.Target, source.Method);
		}

		public static Delegate Convert<T>(Type destinationType, Action<T> source)
		{
			return Delegate.CreateDelegate(destinationType, source.Target, source.Method);
		}

		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "2"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "1")]
		public static Delegate Convert<T1, T2>(Type destinationType, Action<T1, T2> source)
		{
			return Delegate.CreateDelegate(destinationType, source.Target, source.Method);
		}

	}
}